﻿#include <iostream>
#include "seqStack.h"
using namespace std;

template<class DataType>
void SeqStack<DataType>::push(DataType data) {
    if (top == stack_size - 1) throw "Stack full !";
    stack[++top] = data;
}

template<class DataType>
DataType SeqStack<DataType>::pop() {
    if (top == -1)throw "Stack empty !";
    return stack[top--];
}

int main()
{
    int demoArr[] = { 1,2,3,4,5,6,7,8 };
    SeqStack<int> stack;
    for (int da : demoArr) stack.push(da);
    int i = 0;
    int top_value = stack.pop();
    cout << "top_value=" << top_value << endl;
    while (top_value)
    {
        top_value = stack.pop();
        cout << "top_value=" << top_value << endl;
    }

}
